package org.csu.mypetstorebackstage.controller;

import org.csu.mypetstorebackstage.domain.Manager;
import org.csu.mypetstorebackstage.service.AccountService;
import org.csu.mypetstorebackstage.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/common")

public class FunctionController {
    @Autowired
    private AccountService accountService;

//    @GetMapping("/login")
//    public String toLogin() {
//        return "common/login";
//    }
//
//    @RequestMapping("/main")
//    public String login(Manager manager, String password, Model model, HttpSession session) throws Exception {
//
//        Manager loginmanager = managerService.getManagerByManagerNameAndPassword(manager);
//
//        if (loginmanager == null) {
//            model.addAttribute("loginError", "用户名或密码错误，请重试");
//            return "common/login";
//        } else {
//            session.setAttribute("manager", loginmanager);
//            return "common/main";
//        }
//    }

}
